package cn.com.elite;

import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.Element;

public class QueryExamLevel {
	private static final Log log = LogFactory.getLog(QueryExamLevel.class);
	public String queryExamLevel(DataSource dataSource,String ep_id)throws Exception{
		String ReturnXml="";
		String W_ExamLevel="W_ExamLevel";
		String sql="select ExamLevel_ID,ExamLevelDesc from "+W_ExamLevel;
		Object[] params=new Object[]{};  
		int[] types=new int[]{};
		List list=util.QueryPersonUseExecute(sql, types, params, dataSource);
		Document result=util.getDoc();
		Element root=result.addElement("R");
		root.addElement("Result").addText("1");
		if(list!=null&&list.size()>0){
			root.addElement("KsresultLEN").addText(list.size()+"");
			for(int i=0;i<list.size();i++){
				Map map=(Map)list.get(i);
				Element Ksresult=root.addElement("Ksresult");
				String ExamLevel_ID=(String)map.get("ExamLevel_ID");
				Ksresult.addElement("ExamLevel_ID").addText(ExamLevel_ID);
				String  ExamLevelDesc=(String)map.get("ExamLevelDesc");
				Ksresult.addElement("ExamLevelDesc").addText(ExamLevelDesc);
			}
		}
		ReturnXml=result.asXML();	
		return ReturnXml;
	}

}